﻿using System;
using System.Threading.Tasks;
using FormicArch.Core.AssetsCenter;
using UnityEngine;

namespace GameFramework
{
    partial class GameFacade
    {
        
        protected T LoadAsset<T>(string assetName)
        {
            return AssetLoader.LoadAsset<T>(assetName);
        }

        protected async Task<T> LoadAssetAsync<T>(string assetName)
        {
            return await AssetLoader.LoadAssetAsync<T>(assetName);
        }
        protected void LoadAssetAsync<T>(string assetName,Action<T> callback)
        {
            AssetLoader.LoadAssetAsync<T>(assetName, callback);
        }
        protected GameObject LoadPrefab(string assetName)
        {
            return AssetLoader.Instantiate(assetName);
        }

        protected async Task<GameObject> LoadPrefabAsync(string assetName)
        {
            return await AssetLoader.InstantiateAsync(assetName);
        }
        protected void LoadPrefabAsync(string assetName,Action<GameObject> callback)
        {
            AssetLoader.InstantiateAsync(assetName,callback);
        }
        protected bool ReleaseInstance(GameObject obj)
        {
            return AssetLoader.ReleaseInstance(obj);
        }
    }
}